package de.koller.balance.scene;

import de.koller.balance.BNode;
import de.koller.balance.render.BRenderExt;
import org.lwjgl.opengl.GL11;
import org.lwjgl.util.glu.GLU;

public class CommonUses extends BNode {
	
	public void setUpPerspective() {
		GL11.glDisable( GL11.GL_CULL_FACE );
		GL11.glClear( GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT );
		
		GL11.glMatrixMode( GL11.GL_PROJECTION );
		GL11.glLoadIdentity();
		
		BRenderExt r = broot.renderExt;
		if( r.subX == -1 && r.subY == -1 ) {
			GLU.gluPerspective( 60, (float)r.screenW/(float)r.screenH, 0.001f, 2000.0f );
		} else {
			GL11.glScalef( 4, 4, 1 );
			GL11.glTranslatef( -.5f*r.subX+.75f, r.subY*.50f-.75f, 0 );
			GLU.gluPerspective( 60, (float)1920/(float)1080, 0.001f, 2000.0f );
		}
		
		GL11.glMatrixMode( GL11.GL_MODELVIEW );
		GL11.glLoadIdentity();
	}
	
}
